#ifndef EDITEXTRACTIONS_H
#define EDITEXTRACTIONS_H

#include "ui_EditExtractionsWindow.h"
#include "SaveWindow.h"
#include "VideoManagerSingleton.h"
#include <QTime>
#include <QTimer>
#define REFRESH_SLIDER_TIME 200

class EditExtractionsWindow : public QDialog, private Ui::EditExtractionsWindow{
    Q_OBJECT

    public:
    EditExtractionsWindow(QWidget *parent = 0);
    ~EditExtractionsWindow();
    int getVideoWidgetId();
    void addAllExtractions();
    int getCurrentExtractionIndex();
    Extraction getCurrentExtraction();
    void selectFirstItem();

    public slots:
    void closeEvent(QCloseEvent* ce );
    void setPlayIcon();
    void setPauseIcon();
    void playOrPause();
    void _pause();
    void _play();
    void removeSelectedExtraction();
    void addExtraction(int start, int end);
    void seek(int position);
    void updateReadingSliderAndTime();
    void updateReadingSlider();
    void updateTime();
    void selectExtraction(int id);
    void updateAfterStartTimeEditsChanged(QTime startTime);
    void updateAfterEndTimeEditsChanged(QTime endTime);
    void updateAfterSpanSliderChanged(int lowerValue, int upperValue);
    void _updateSpanSliderBoundaries();
    void _updateSpanSliderValues();
    void _updateTimeEditValues();
    void _updateReadingSliderBoundaries();
    void _eventuallyUpdateExtractedVideoPosition();
    void _changeCurrentExtractionValues(int start, int end);
    void _updateCurrentExtractionText();
    void _resetExtractionView();
    void sayVideoSavedAndRenableWidgets();
    void saySavingVideo();
    void sayCalculingExtractionAndDiseableWidgets();
    void sayNothingAndEnableWidgets();
    void save();

    signals:
    void play();
    void pause();

    private:
    SaveWindow* saveWindow;
    VideoManagerSingleton *videoManager;
    QTimer *timer;
    QIcon *playIcon;
    QIcon *pauseIcon;
    bool userChangingTimeEdit;
};

#endif // EDITEXTRACTIONS_H
